#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
    long long int t;
    scanf("%lld", &t);
    for (long long int i = 0; i < t; i++)
    {
        long long int n;
        scanf("%lld", &n);
        long long int sum = 0;
        while (n)
        {
            if (n & 1)
            {
                sum++;
            }
            n = n >> 1;
        }
        long long int num = pow(2, sum) - 1;
        printf("%lld %lld\n", sum, num);
    }
    return 0;
}